/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

/**
 * 等待输出流中的内容排空后再执行退出
 *
 * @param code exitCode
 */
export function exit(code: number) {
  if (process.platform === 'win32' && process.stdout.writableLength) {
    process.stdout.once('drain', function () {
      process.exit(code);
    });
    return;
  }
  process.exit(code);
}
